package com.hkfg.config;

import org.springframework.context.annotation.*;
import org.springframework.stereotype.Controller;
import org.springframework.web.multipart.MultipartResolver;
import org.springframework.web.multipart.commons.CommonsMultipartResolver;

import javax.sql.DataSource;

@Configuration
@ComponentScan({"com.hkfg.service", "com.hkfg.dao"})       // 扫描   排除，按照注解排除，Controller注解
@PropertySource("classpath:jdbc.properties")
@Import({JdbcConfig.class, MyBatisConfig.class})
//@EnableAspectJAutoProxy      // 开启sping对aop注解驱动支持
public class SpringConfig {

    /*文件上传配置*/
    @Bean
    public MultipartResolver multipartResolver(){
        CommonsMultipartResolver multipartResolver = new CommonsMultipartResolver();
        multipartResolver.setMaxUploadSize(100*1024*1024);
        multipartResolver.setDefaultEncoding("utf-8");
        return multipartResolver;
    }

//            <!-- 文件上传的解析器 -->
//        <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
//        	<!-- 上传图片的最大尺寸 10M-->
//        	<property name="maxUploadSize" value="10485760"></property>
//        	<!-- 默认编码 -->
//        	<property name="defaultEncoding" value="utf-8"></property>
//        </bean>


}
